<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tag list</title>
    <script src="/js/jquery.min.js"></script>
    <style type="text/css">
        .tag-list{padding:10px;}
        .tag-list label{
            margin: 5px;
            padding: 5px;
            cursor:pointer;
            font-size: 18px;
            float: left;
            border-radius: 3px;
        }
        .tag-list label:hover {
            background-color: #1d9d74;
            color: #ffffff;}
    </style>
</head>
<body>
<div class="tag-list"></div>
<script type="text/javascript">
     $(function () {
         $.get('/system/tag/list',function (res) {
             var data = res.rows;
             var html = '';
             for (var i = 0; i < data.length; i++){
                 var tag = "'"+data[i].tagName+"'";
                 html += '<label onclick="getTag('+tag+')">'+data[i].tagName+'</label>';
             }
             $('.tag-list').html(html);
         });
     });
    var index = parent.layer.getFrameIndex(window.name);
    //给父页面传值
     function getTag(tagName) {
         var parentVal = parent.$('#tags').val();
         if(parentVal){
             parentVal += ",";
         }
         parent.$('#tags').val(parentVal+tagName);
         parent.layer.close(index);
     }
</script>
</body>
</html>